<%--
  Created by IntelliJ IDEA.
  User: ztc
  Date: 16-3-21
  Time: 下午2:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
</head>
<script type="text/javascript">
  function myajax() {
    var myhttp;
    myhttp=new XMLHttpRequest();
    myhttp.open("GET", "qrajax", true);
    myhttp.send();
    myhttp.onreadystatechange=function()
    {
      if (myhttp.readyState==4 && myhttp.status==200)
      {
        var msg=myhttp.responseText;
        document.getElementById("asd").innerHTML=msg;
        if(msg!="failed"){
          document.getElementById("QRcode").src=
                  "qrcoder?flag="+Math.random()+"&teacherID="+document.getElementById("tecID").value;
        }
      }
    }
  }
  function lunxun(){
    window.setInterval(myajax,10000);
  }
  myajax();
  lunxun();
</script>
<body>
<textarea id="asd">asd</textarea>
<img src="qr" id="QRcode"/>
<input type="text" id="tecID"/>
<button type="button" onclick="myajax()">Change Content</button>
</body>
</html>
